package com.link.base.base.acctmsgconnect.controller;

import com.link.base.base.acctmsgconnect.model.AcctMsgConnect;
import com.link.base.base.acctmsgconnect.service.AcctMsgConnectService;
import com.link.base.base.order.service.SaleOrderService;
import com.link.base.base.reception.service.ReceptionService;
import com.link.core.cllog.LCLogger;
import com.link.core.basic.annotations.JsonParam;
import com.link.core.basic.controller.BasicController;
import com.link.core.basic.query.QueryParams;
import com.link.core.basic.service.BasicService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;

/**
 * @author : LiQun
 * @date : 下午5:24 2018/4/19
 * @dscription : 客户短信连接
 */

@Controller
@RequestMapping("/link/acctMsgConnect")
public class AcctMsgConnectController extends BasicController<AcctMsgConnect> {


    @Resource
    private AcctMsgConnectService guideAcctMsgConnectService;

    @Resource
    private ReceptionService receptionService;

    @Resource
    private SaleOrderService saleOrderService;

    @Override
    public BasicService<AcctMsgConnect> getBasicService() throws Exception {
        return guideAcctMsgConnectService;
    }

    /**
     * 营销助手未登录状态下分享
     * @author 旷锐锋
     * @date 2019/2/21
     */
    @RequestMapping(value = "/notLogin/queryByExamplePage")
    @ResponseBody
    public Map<String, Object> query(@JsonParam AcctMsgConnect acctMsgConnect, @JsonParam QueryParams qps,
                                     HttpSession session, HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> result = new HashMap<String, Object>(8);
        try {
            result = super.queryByExamplePage(qps, acctMsgConnect, session, request, response);
        } catch (Exception e) {
            result.put("success", false);
            result.put("msg", e.getMessage());
            LCLogger.withException(e);
        }
        return result;
    }
}
